package serialization;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class DeserializationMain {
	
	public static void main(String[] args) throws Exception {
		
		// file -> object
		
		FileInputStream fis = new FileInputStream("C:\\serial\\tree.dat");
		
		ObjectInputStream ois = new ObjectInputStream(fis);
		
		Object obj = ois.readObject();
		
		System.out.println(obj instanceof Tree);
		
		if (obj instanceof Tree) {
			Tree tree = (Tree) obj;
			
			System.out.println(tree.getType());
			System.out.println(tree.getLeafShape());
		}
		
		ois.close();
		fis.close();
		
	}
	
}
